导航菜单
首页 >  How to Install Prometheus as a Windows Service with AlwaysUp  > How to run any PHP Script as a Windows Service

How to run any PHP Script as a Windows Service

Start a command prompt (Start button > Run > cmd.exe)

In the window that appears, type the full path to the PHP executable (php.exe) followed by the full path to the script you wish to run as a windows service. Be sure to quote each component containing at least one space!

Since we have placed PHP in C:\PHP, and our script is C:\PHP\sample-php-script.php, our command line is:

C:\PHP\php.exe C:\PHP\sample-php-script.php

Hit the Enter key to execute the command line. If your script doesn't work as expected please resolve the issues now.

Note that if your script doesn't work here then it won't work with AlwaysUp!

Here's the code of our simple script:

And here is the result from running it on the command line:

Everything looks good!

相关推荐: